package com.dao;

import com.homework.config.SpringConfig;
import com.homework.dao.UserDao;
import com.mysql.cj.util.DnsSrv;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.sql.SQLException;


@ContextConfiguration(classes=SpringConfig.class)
public class Demo {
    @Autowired
    private UserDao userDao;
    public static void main(String[] args) throws SQLException{
        ApplicationContext context=new AnnotationConfigApplicationContext(SpringConfig.class);
        UserDao userDao1=context.getBean(UserDao.class);
        int count=userDao1.selectCount();
        System.out.println(count);
    }
}
